package com.zxq.web.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 某数据包下，具体某一条指令
 * @TableName iot_cmd
 */
@TableName(value ="iot_cmd")
@Data
public class IotCmdDo implements Serializable {
    /**
     * 主键id
     */
    @TableId
    private Long id;

    /**
     * 帧id，帧id和指令hex配合，完成一个整帧的解析
     */
    private Long packetId;

    /**
     * 指令码hex标识，程序内解析所得与之比较
     */
    private String cmdHexId;

    /**
     * 发起方 0设备 1平台
     */
    private Integer sponsor;

    /**
     * 0 指令，需要回复；1 指令，不需要回复；2 回复指令；


     */
    private Integer cmdType;

    /**
     * hex报文(用空格分开)
     */
    private String hex;

    /**
     * json数据,hex码转换的数据
     */
    private String json;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 创建时间
     */
    private Date createDate;

    /**
     * 更新者
     */
    private Long updater;

    /**
     * 更新时间
     */
    private Date updateDate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        IotCmdDo other = (IotCmdDo) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getPacketId() == null ? other.getPacketId() == null : this.getPacketId().equals(other.getPacketId()))
            && (this.getCmdHexId() == null ? other.getCmdHexId() == null : this.getCmdHexId().equals(other.getCmdHexId()))
            && (this.getSponsor() == null ? other.getSponsor() == null : this.getSponsor().equals(other.getSponsor()))
            && (this.getCmdType() == null ? other.getCmdType() == null : this.getCmdType().equals(other.getCmdType()))
            && (this.getHex() == null ? other.getHex() == null : this.getHex().equals(other.getHex()))
            && (this.getJson() == null ? other.getJson() == null : this.getJson().equals(other.getJson()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getCreator() == null ? other.getCreator() == null : this.getCreator().equals(other.getCreator()))
            && (this.getCreateDate() == null ? other.getCreateDate() == null : this.getCreateDate().equals(other.getCreateDate()))
            && (this.getUpdater() == null ? other.getUpdater() == null : this.getUpdater().equals(other.getUpdater()))
            && (this.getUpdateDate() == null ? other.getUpdateDate() == null : this.getUpdateDate().equals(other.getUpdateDate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getPacketId() == null) ? 0 : getPacketId().hashCode());
        result = prime * result + ((getCmdHexId() == null) ? 0 : getCmdHexId().hashCode());
        result = prime * result + ((getSponsor() == null) ? 0 : getSponsor().hashCode());
        result = prime * result + ((getCmdType() == null) ? 0 : getCmdType().hashCode());
        result = prime * result + ((getHex() == null) ? 0 : getHex().hashCode());
        result = prime * result + ((getJson() == null) ? 0 : getJson().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getUpdater() == null) ? 0 : getUpdater().hashCode());
        result = prime * result + ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", packetId=").append(packetId);
        sb.append(", cmdHexId=").append(cmdHexId);
        sb.append(", sponsor=").append(sponsor);
        sb.append(", cmdType=").append(cmdType);
        sb.append(", hex=").append(hex);
        sb.append(", json=").append(json);
        sb.append(", remark=").append(remark);
        sb.append(", creator=").append(creator);
        sb.append(", createDate=").append(createDate);
        sb.append(", updater=").append(updater);
        sb.append(", updateDate=").append(updateDate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}